<template>
    <div class="nav" style="width: 300px;">
        <el-menu style="height: 800px" default-active="2" class="el-menu-vertical-demo" @open="handleOpen"
            @close="handleClose" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b">
            <el-submenu index="1" v-if="userGroup === '求职者'">
                <template slot="title">
                    <i class="el-icon-location"></i>
                    <span style="font-size:30px">求职</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="1-1" @click="seekersInfo"><i class="el-icon-document"></i>求职信息</el-menu-item>
                    <el-menu-item index="1-2" @click="goResume"><i class="el-icon-document"></i>我的简历</el-menu-item>
                    <el-menu-item index="1-3" @click="goDeliverResume"><i class="el-icon-document"></i>已投递简历</el-menu-item>
                </el-menu-item-group>
            </el-submenu>
            <el-submenu index="1" v-if="userGroup === '企业'">
                <template slot="title">
                    <i class="el-icon-location"></i>
                    <span style="font-size:30px">招聘信息</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="1-1" @click="goEnterpriseJobList"><i
                            class="el-icon-s-claim"></i>已发布职位</el-menu-item>
                    <el-menu-item index="1-2" @click="goEnterpriseInformation"><i
                            class="el-icon-document"></i>公司信息</el-menu-item>
                    <el-menu-item index="1-3" @click="goPublishJob"><i class="el-icon-edit-outline"></i>发布新职位</el-menu-item>
                </el-menu-item-group>
            </el-submenu>
            <el-submenu index="1" v-if="userGroup === '管理员'">
                <template slot="title">
                    <i class="el-icon-location"></i>
                    <span style="font-size:30px">管理</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="1-1">
                        <i class="el-icon-menu"></i>
                        <span slot="title" @click="goAdmin">后台管理</span>
                    </el-menu-item>
                </el-menu-item-group>
            </el-submenu>
            <el-menu-item index="2" @click="personalInfo">
                <i class="el-icon-menu"></i>
                <span slot="title">个人信息</span>
            </el-menu-item>
            <el-menu-item index="3" @click="goCommentList">
                <i class="el-icon-bell"></i>
                <span slot="title">消息</span>
            </el-menu-item>
            <el-menu-item index="4" @click="updatePassword">
                <i class="el-icon-setting"></i>
                <span slot="title">修改密码</span>
            </el-menu-item>
        </el-menu>
    </div>
</template>
<script>
export default {
    data() {
        return {
            userGroup: window.localStorage.getItem("user_group"),
        };
    },
    methods: {
        goCommentList() {
            this.$router.push({ name: 'comment_list' }, () => { }, () => { });
        },
        goDeliverResume() {
            this.$router.push({ name: 'deliver_resume_list' }, () => { }, () => { });
        },
        goAdmin() {
            window.open("http://127.0.0.1:8081/");
        },
        goPublishJob() {
            this.$router.push({ name: 'publish_job' }, () => { }, () => { });
        },
        goEnterpriseJobList() {
            this.$router.push({ path: '/personal_center/enterprise_job_list' }, () => { }, () => { });
        },
        goEnterpriseInformation() {
            this.$router.push({ path: '/personal_center/enterprise_information' }, () => { }, () => { });
        },
        goResume() {
            this.$router.push({ path: '/personal_center/resume_list' }, () => { }, () => { });
        },
        personalInfo() {
            this.$router.push({ path: '/personal_center' }, () => { }, () => { });
        },
        seekersInfo() {
            this.$router.push({ path: '/personal_center/seekersInfo' }, () => { }, () => { });
        },
        updatePassword() {
            this.$router.push({ path: '/user/change_password' }, () => { }, () => { });
        },
        handleOpen(key, keyPath) {

        },
        handleClose(key, keyPath) {

        },
    }
}
</script>
<style lang="less" scoped>
.nav {
    width: 30%;
    height: 500px;
}
</style>